import {get,post } from '../utils/request'

// 项目中的接口都放到该文件中进行管理

// 获取首页的数据
export const getHomeData = (params = {}) => {
  return get("/page/detail",params)
}
// 商品详情
export const getGoodDetail = (params = {}) => {
  return get('/goods/detail', params)
}
// 商品服务
export const getService = (params = {}) => {
  return get('/goods.service/list', params)
}

// 获取分类的列表
export const getCategoryData = (params) => {
  return get("/category/list",params)
}

// 搜索接口
export const startSearch = (params) => {
  return get("/goods/list", params)
}

// 快捷登录
export const loginMpWx = (params) => {
  return post("/passport/loginMpWx", params)
}

// 手机注册接口

export const login = (params) => {
  return post("/passport/login", params)
}

//获取用户信息
export const getUserInfo = (params) => {
  return get("/user/info", params)
}
// 获取收货地址列表
export const getAddressList = (params) => {
  return get("/address/list", params)
}

// 获取 省市区列表 /region/tree

export const getRegionTree = (params) => {
  return get("/region/tree", params)
}

// 新增省市区 /address/add
export const  addAddress = (params) =>{
  return post('/address/add', params)
}

// 获取默认地址 /address/defaultId
export const getDetaulAddresId = (params) => {
  return get("/address/defaultId", params)
}
// 设置默认地址 /address/setDefault

export const  setDefaultAddress = (params) =>{
  return post('/address/setDefault', params)
}

// 删除地址 /address/remove

export const removeAddress = (params) =>{
  return post('/address/remove', params)
}

// 加入购物车 /cart/add

export const addToCart = (params) =>{
  return post('/cart/add', params)
}

// 购物车列表 /cart/list
export const getCartList = (params) => {
  return get("/cart/list", params)
}

// 购物车购买结算 /checkout/submit
export const orderSubmit = (params) =>{
  return post('/checkout/submit', params)
}

// /checkout/order
export const checkoutOrder = (params) => {
  return get('/checkout/order', params)
}

// /order/list
export const getMyOrderList = (params)=>{
  return get('/order/list', params)
}
// 确认收货 /order/receipt
export const orderReceipt = (params) =>{
  return post('/order/receipt', params)
}